package com.chap9;

import javax.swing.*;
import java.awt.*;

public class DemoGrid extends JFrame{
    JButton jb[];
    public static void main(String[] args) {
        DemoGrid win=new DemoGrid();
    }
    public DemoGrid(){
        jb=new JButton[9];
//        this.setLayout(new GridLayout(3,3,10,20));
        this.setLayout(new GridLayout(3,3));
        for(int i=0;i<jb.length;i++){
            jb[i]=new JButton(""+(i+1));
            this.add(jb[i]);
        }
        setTitle("GridLayout");
        this.setSize(400,500);
        this.setLocation(300,300);
        this.setVisible(true);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }
}
